package com.acpt.common.web.config;

import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.DispatcherServlet;

@Configuration
public class FeignConfig {

  /**
   * 让DispatcherServlet向子线程传递RequestContext
   * @param servlet servlet
   * @return 注册bean
   */
  @Bean
  public ServletRegistrationBean<DispatcherServlet> dispatcherRegistration(DispatcherServlet servlet) {
    servlet.setThreadContextInheritable(true);
    return new ServletRegistrationBean<>(servlet, "/**");
  }




}
